package scalab.core.event

//type E = T forSome {type T <: Event}

sealed trait Listener[-E <: Event] extends (E => Unit){

	/*private[core] def triggerEvent[E](event: E): Unit = react(event)
	def react[E](event: E): Unit*/
}

object Listener{
	def apply[E <: Event](handler: E => Unit): Listener[E] = new Listener[E]{
		def apply(event: E): Unit = handler(event)
	}

	/*def apply(handler: BuildFinished => Unit): Listener[BuildFinished] = new Listener[BuildFinished]{
		def apply(event: BuildFinished): Unit = handler(event)
	}*/
}

/*sealed trait UpdateListener[U <: UpdateEvent] extends Listener[U]

trait UpdateStartedListener extends UpdateListener[UpdateStarted]
trait UpdateFinishedListener extends UpdateListener[UpdateFinished]

sealed trait ExecutionListener[E <: ExecutionEvent] extends Listener[E]

trait ExecutionStartedListener extends ExecutionListener[ExecutionStarted]
trait ExecutionFinishedListener extends ExecutionListener[ExecutionFinished]*/

/*sealed trait BuildListener extends Listener[BuildEvent]

trait BuildStartedListener extends BuildListener
trait BuildFinishedListener extends BuildListener*/

